﻿using Prism.Navigation.Msg;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace Prism.Navigation.Views
{
    /// <summary>
    /// Shell.xaml 的交互逻辑
    /// </summary>
    public partial class Shell : Window
    {

        public Shell(IEventAggregator eventAggregator)
        {
            InitializeComponent();
            eventAggregator.GetEvent<ChangeWindowSizeMessage>().Subscribe(message => {
                Width = message.Width;
                Height = message.Height;
                // 计算窗口位置使其居中
                Left = (SystemParameters.PrimaryScreenWidth - Width) / 2;
                Top = (SystemParameters.PrimaryScreenHeight - Height) / 2;
            } );
        }
    }
}
